import {defineStore} from 'pinia'

import {getMenuListApi} from '@/api/system/menu/menu'

export const useMenuStore = defineStore({
    id: 'menuState',
    state: () => ({
        register: false, //路由是否注册
        routers: []
    }),
    getters: {},
    actions: {
        //生成路由
        generateRouter: async  function() {
            const {data} = await getMenuListApi()
            this.routers = data.result
            return data.result
        }
    },
    persist: true
})
